package top.whysu.edevice.controller.system;

import org.springframework.web.bind.annotation.*;
import top.whysu.edevice.dto.generate.RequestDTO;
import top.whysu.edevice.dto.generate.ResponseDTO;
import top.whysu.edevice.service.system.DataDictionaryDTO;
import top.whysu.edevice.service.system.DataDictionaryService;
import top.whysu.edevice.utils.ResponseUtil;

import javax.annotation.Resource;
import java.util.List;

/**
 * 公共
 */
@RestController
@RequestMapping("/common")
public class CommonController {

    @Resource
    private DataDictionaryService dataDictionaryService;

    /**
     * 数据字典查询
     */
    @PostMapping(value = "/getDictionary")
    @ResponseBody
    public ResponseDTO<List<DataDictionaryDTO>> getDictionary(@RequestBody final RequestDTO request) {
        List<DataDictionaryDTO> list = dataDictionaryService.selectList();
        return ResponseUtil.getSuccessResponse(request.getHeader(), list);
    }
}